package com.bmw.system.controller;

import org.apache.http.HttpRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2018/11/27.
 */
@Controller
public class SystemController {

    protected static String REDIRECT = "redirect:";

    @GetMapping("/")
    public String login(){
        return "system/login.html";
    }

    @RequestMapping("login")
    @ResponseBody
    public String login(String name ,String pwd){

        if(!name.equals("Jinmy")){
            return "账号错误或不存在";
        }else if(!pwd.equals("jinmingyu569")){
            return "密码错误";
        }else{
            return REDIRECT+"/index";
        }
    }

    @RequestMapping("index")
    public String index(){
        return "system/index.html";

    }

}
